package com.zhida.courseservice.controller;

import com.zhida.common.entity.Result;
import com.zhida.courseservice.entity.Activity;
import com.zhida.courseservice.entity.Course;
import com.zhida.courseservice.service.IActivityService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ling
 * @since 2024-07-17
 */
@RestController
@RequestMapping("/activity")
public class ActivityController {

    @Resource
    IActivityService activityService;

    @PostMapping("/createActivity")
    public Result<?> createActivity(@RequestBody Activity activity){
        return activityService.createActivity(activity);
    }

    @GetMapping("/getActivityInfo/{activity_id}")
    public Result<?> getActivityInfo(@PathVariable Integer activity_id){
        return activityService.getActivityInfo(activity_id);
    }

    @PostMapping("/updateActivityInfo")
    public Result<?> updateActivityInfo(@RequestBody Activity activity){
        return activityService.updateActivityInfo(activity);
    }

    @GetMapping("/getActivities/{current}/{pageSize}")
    public Result<?> getActivities(@PathVariable Integer current,@PathVariable Integer pageSize){
        return activityService.getActivities(current,pageSize);
    }
}
